#pragma once

#include <windows.h>
#include <string>

class BMPSaver {
public:
    BMPSaver();
    ~BMPSaver();

    bool SaveBitmap(HBITMAP hBitmap, const std::string& filePath);
    bool CreateDirectoryIfNotExists(const std::string& dirPath);
    std::string GetLastError() const { return m_lastError; }

private:
    bool WriteBitmapToFile(HBITMAP hBitmap, const std::string& filePath);
    DWORD GetBitmapBits(HBITMAP hBitmap, LPVOID* ppvBits, PBITMAPINFO pbi);

private:
    std::string m_lastError;
};